
function initPage() {
	
    $('div.messageText').click(function() {
        $(this).toggleClass('messagePopup');
    });  
    
    $('table.groupHead').click(function() {
        var checkElement = $(this).parent().next();
        var overLayerHeight = document.body.offsetHeight - 70;
        
        $('div.overlayer').each( function(){
           $this=$(this);
           if($this.is(':visible')) {
               $this.slideUp('fast');
               return false;
           }
        });
    
        if((checkElement.is('div.overlayer')) && (!checkElement.is(':visible'))) {
            if($(this).hasClass('collapsible')) {
                checkElement.slideDown('normal', function() {
                    window.scrollTo(checkElement.offset().left , checkElement.offset().top-35);
                });
            }
            return false;
        }
    });
    
    var colorList = ["#804040","#804b40","#805740","#806340","#806e40","#807a40","#7a8040","#6e8040","#638040","#578040","#4b8040","#408040","#40804b","#408057","#408063","#40806e","#40807a","#407a80","#406e80","#406380","#405780","#404b80","#404080","#4b4080","#574080","#634080","#6e4080","#7a4080","#80407a","#80406e","#804063","#804057","#80404b"];
    
    $('table.groupHead').mouseenter(function() {
        $this = $(this);
        var index = $('table.groupHead').index($this)
        $this.css('background-color', colorList[index]);
        $this.addClass('groupHeadMouseover');
    }).mouseleave(function() {
        $this = $(this);
    	$this.css('background-color', '');
    	$this.removeClass('groupHeadMouseover');
    });
    
}

$(document).ready(function() {initPage();});
